/**
* 全局标量
*/
var MainTopRoll=new xwzRollingImageTrans('IMG_MAIN_TOP_ROLL_DETAIL','IMGS_MAIN_TOP_ROLL_THUMBNAIL');

/**
* 页面入口
*/
$(document).ready(function()
{
	/**
	* 订单查询
	*/	
	var ordersheet_button=$('#Ordersheet_Button');
	var ordersheet_shipyardName=$('#Ordersheet_ShipyardName');
	var ordersheet_shipownerName=$('#Ordersheet_ShipownerName');
	var ordersheet_shiponwerNationality=$('#Ordersheet_ShiponwerNationality');
	var ordersheet_amount=$('#Ordersheet_Amount');
	var ordersheet_giveDatetime_Year=$('#Ordersheet_GiveDatetime_Year');
	var ordersheet_giveDatetime_Month=$('#Ordersheet_GiveDatetime_Month');
	var ordersheet_datetime_Year=$('#Ordersheet_Datetime_Year');
	var ordersheet_datetime_Month=$('#Ordersheet_Datetime_Month');
	
	ordersheet_button.click(function()
	{
		var isNotWrite=ordersheet_shipyardName.val()==''&&ordersheet_shipownerName.val()=='';
		{
			isNotWrite=isNotWrite&&ordersheet_shiponwerNationality.val()==''&&ordersheet_amount.val()=='';
			isNotWrite=isNotWrite&&ordersheet_giveDatetime_Year.val()=='0'&&ordersheet_giveDatetime_Month.val()=='0';
			isNotWrite=isNotWrite&&ordersheet_datetime_Year.val()=='0'&&ordersheet_datetime_Month.val()=='0';			
		}

		if(isNotWrite)
		{
			ordersheet_shipyardName.focus();
			return false;
		}
		
		var location='/exec.php?action=shipyard_ordersheet&type=search';
		{
			if(ordersheet_shipyardName.val()!=''){
				location=location+'&shipyardname='+encodeURI(ordersheet_shipyardName.val());
			}
			
			if(ordersheet_shipownerName.val()!=''){
				location=location+'&shipownername='+encodeURI(ordersheet_shipownerName.val());
			}
			
			if(ordersheet_shiponwerNationality.val()!=''){
				location=location+'&shiponwernationality='+encodeURI(ordersheet_shiponwerNationality.val());
			}
			
			if(ordersheet_amount.val()!=''){
				location=location+'&amount='+encodeURI(ordersheet_amount.val());
			}
			
			if(ordersheet_giveDatetime_Year.val()!='0'){
				location=location+'&givedatetime_year='+ordersheet_giveDatetime_Year.val();
			}
			
			if(ordersheet_giveDatetime_Month.val()!='0'){
				location=location+'&givedatetime_month='+ordersheet_giveDatetime_Month.val();
			}
			
			if(ordersheet_datetime_Year.val()!='0'){
				location=location+'&datetime_year='+ordersheet_datetime_Year.val();
			}
			
			if(ordersheet_datetime_Month.val()!='0'){
				location=location+'&datetime_month='+ordersheet_datetime_Month.val();
			}			
		}
		
		window.location=location;
		
		return false;
	});
	
	/**
	* 按省份查询
	*/		
	$.initProv("#Area_Province","#Area_City");
	var area_button=$('#Area_Button');
	var area_province=$('#Area_Province');
	var area_city=$('#Area_City');	
	
	area_button.click(function()
	{		
		if(area_province.val()=='-1'&&area_city.val()=='-1')
		{
			area_province.focus();
			return false;
		}
	
		var location='/exec.php?action=shipyard_account_list&type=search';
		{
			if(area_province.val()!='-1'){
				location=location+'&province='+area_province.val();
			}
			
			if(area_city.val()!='-1'){
				location=location+'&city='+area_city.val();
			}			
		}
		window.location=location;	
		return false;
	});
	
	/**
	* 幻灯片
	*/
	var slideData=[];	
	$.get('/data/slide/shipyard.xml',function($data)
	{
		$($data).find('item').each(function()
		{
			var $this=$(this);
			slideData[slideData.length]={'item_url':$this.attr('item_url'),'link':$this.attr('link')};											
		});
		
		var m_nPageInitTime=new Date();			
		MainTopRoll.addItem(slideData[0].link,slideData[0].item_url);
		MainTopRoll.addItem(slideData[1].link,slideData[1].item_url);
		MainTopRoll.addItem(slideData[2].link,slideData[2].item_url);
		
		$('#IDS_DIV_MAIN_TOP_ROLL_DETAIL').html('<IMG class=clssMainRoll height=173 src="'+slideData[0].item_url+'" width=238 border=0 name=IMG_MAIN_TOP_ROLL_DETAIL>');
		
		var tmp='<IMG style="DISPLAY: none" height=5 src="" width=9 align=absMiddle border=0';
		tmp=tmp+' name=IMGS_MAIN_TOP_ROLL_THUMBNAIL><IMG';
		tmp=tmp+' style="CURSOR: pointer" onclick=MainTopRoll.alterImage(#_index_#)';		
		tmp=tmp+' src="#_src_#" width="58" height="50" border=0>';

		$('#Slide_0').html(tmp.replace('#_src_#',slideData[0].item_url).replace('#_index_#',0));
		$('#Slide_1').html(tmp.replace('#_src_#',slideData[1].item_url).replace('#_index_#',1));
		$('#Slide_2').html(tmp.replace('#_src_#',slideData[2].item_url).replace('#_index_#',2));			
		
		MainTopRoll.Index=parseInt('0');
		MainTopRoll.install();	
	});		
});